<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib prefix="sys" uri="/WEB-INF/tld/sys.tld" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>金融机构上报配置列表页</title>
    <style type="text/css">
        .searchArea .fieldBox .label {
            width: 70px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">

<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <div tabid="tabA" title="上报状态解析" lselected="true">
            <div class="searchArea">
                <form id="searchBar">
                    <div class="fieldset1 clearFix">
                        <div class="fieldBox">
                            <div class="label">机构名称</div>
                            <div class="field">
                                <input name="funNm" id="funNm" type="text" class="ui-textbox" value="">
                            </div>
                        </div>
                        <div  class="fieldBox">
                            <div class="label">金融局入库状态</div>
                            <div class = "field">
                                <select name="asynCode" id="asynCode" data-value=" ">
                                    <option value=" " seleted>请选择</option>
                                    <option value="2">风险上报</option>
                                    <option value="1">非风险上报</option>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox">
                            <div class="label">逾期天数</div>
                            <div class="field">
                                <input name="overDueDaysStart" id="overDueDaysStart" type="text" class="ui-textbox" value="">-
                                <input name="overDueDaysEnd" id="overDueDaysEnd" type="text" class="ui-textbox" value="">
                            </div>
                        </div>
                        <div class="fieldBox">
                            <div class="label">机构放款时间</div>
                            <div class="field">
                                <input ligerui="width: 120" name="payTmStart"
                                       id="payTmStart" type="text" class="ui-datepicker" value=""> - <input
                                    ligerui="width: 120" name="payTmEnd" id="payTmEnd"
                                    type="text" class="ui-datepicker" value="">
                            </div>
                        </div>
                        <div class="clearFix"></div>
                        <div class="formBtns notRight">
                            <span id="searchBtn" class="sq-button sq-button-round"></i>查询</span>
                            <span id="clearBtn" class="sq-button sq-button-round"></i>清空</span>
                            <span id="addBtn" class="sq-button sq-button-round"></i>上报方案配置</span>
                        </div>
                    </div>
                </form>
            </div>

            <div id="ligergrid1" class="sq-grid"></div>
        </div>
    </div>
</div>


<script type="text/javascript">
    var grid = null;
    var callback = null;
    var _upLoadCode = '${upLoadCode}';
    var _dataTyp = '${dataTyp}';
    var pageInTab = null;
    var loadedTabs = [];
    var pageInApp = {
        flag: true
    };
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/fgifuncfg/fgiFunCfg/initList.do',
            method: 'get',
            columns: [
                {display: '序号', name: 'id', width: 200, align: 'left', enabledSort: false, hide: true},
                {display: '创建时间', name: 'crtTm', width: 100, align: 'center', enabledSort: false,
                    render:function (rowdata,index,value) {
                        return renderDate(rowdata,index,value);
                    }
                },
                {display: '创建者', name: 'crtUsrNm', width: 200, align: 'left', enabledSort: false},
                {display: '机构名称', name: 'funNm', width: 100, align: 'center', enabledSort: false},
                {display: '上报类型', name: 'upTypNm', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if(rowdata.upTyp == 2){
                            return "风险上报";
                        }else{
                            return "非风险上报";
                        }
                    }
                },
                {display: '机构放款时间', name: 'payTm', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if(value){
                            return value ;
                        }else{
                            return "——";
                        }
                    }
                },
                {display: '逾期天数', name: 'overdueDays', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if(value){
                            return value ;
                        }else{
                            return "————";
                        }
                    }
                },
                {
                    display: '使用状态', name: 'isNew', width: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if (value && value == '1') {
                            return "使用中";
                        } else{
                            return "已废弃";
                        }
                    }
                },
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
            frozen: false
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        //initTab();
        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "fileNm": " ",
                "uploadUsrNm": " "
            });
        });

        callback = function () {
            grid.reload();
        };

        $("#file1").attr("accept", "application/vnd.ms-excel");
    });
    $("#addBtn").click(function (event) {
        var _titleNm = '新增经融机构上报配置';
        $.ligerDialog.SQopen({
            width: 900,
            height: 400,
            title: _titleNm,
            url: '<%=path%>/fgifuncfg/fgiFunCfg/toAddPage.do',
            onClose: function () {
                callback();
            }
            /*buttons: [{
                text: "保存", type: 'ok', cls: 'l-dialog-btn-ok',
                onclick: function (item, Dialog) {
                    if (Dialog.onOk) Dialog.onOk();
                }
            }, {
                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no',
                onclick: function (item, Dialog) {
                    if (Dialog.onCancel) Dialog.onCancel();
                }
            }
            ]*/
        });
    })

    function dialogCallback() {
        $.ligerDialog.hide();
        grid.reload();
    }
    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "——";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

    //格式化时间
    function renderDate2(rowdata, index, value) {
        var dateStr = "——";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

</script>
</body>
</html>
